home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / technote / tchntstc.sit / Technical Notes Stack 3.2.1 / Technical Notes Stack 3.2.1 / card_67084.txt < prev    next >
Encoding:
Text File  |  1990-01-08  |  2.5 KB  |  55 lines

  1. -- card: 67084 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2711
  5. -- name: 213 _StripAddress:  The Untold Story
  6.  
  7.  
  8. -- part contents for background part 9
  9. ----- text -----
  10. #213: _StripAddress:  The Untold Story
  11.  
  12. See also:    Inside Macintosh, Volume V, The OS Utilities
  13.              Technical Note #212:  The Joy of Being 32-Bit Clean
  14.  
  15. Written by:    Andrew Shebanow          October 1, 1988
  16. ________________________________________________________________________________ 
  17.  
  18. Inside Macintosh, Volume V, The OS Utilities, incorrectly documents the 
  19. _StripAddress trap; this Technical Note correctly documents the trap.
  20. ________________________________________________________________________________ 
  21.  
  22. FUNCTION StripAddress(theAddress: Ptr): Ptr;
  23.  
  24. The _StripAddress trap now takes a Ptr as a parameter and returns a Ptr instead of a LONGINT as documented in Inside Macintosh.
  25.  
  26. Apple provides the _StripAddress trap to help developers ensure the legality of handle addresses.  Because the current version of the Memory Manager stores its flags in the high byte of the master pointer, it is necessary to call _StripAddress before using a handle when in 32-bit mode.  A call to _StripAddress might be appropriate in a driver for a NuBus card that is configured with more than one megabyte of memory.  If the driver needs to copy data from a handle to the memory on the card, it needs to switch the Macintosh into 32-bit mode before it performs the copy.  If the driver dereferences the handle without calling _StripAddress, it may be invalid, and you might get a bus error.
  27.  
  28. The true behavior of _StripAddress on the passed address is:
  29.  
  30. Operating System   24-Bit Mode              32-Bit Mode
  31. Current Macs       masked with Lo3Bytes     masked with Lo3Bytes
  32. A/UX               (never in 24 bit mode)   address unchanged
  33. Future Macs        (never in 24 bit mode)   address unchanged
  34.  
  35.  
  36. The _StripAddress trap is incorrectly described in the OS Utilities chapter of Inside Macintosh, Volume V:
  37.  
  38.      FUNCTION StripAddress(theAddress: LONGINT): LONGINT;
  39.  
  40. If the system is running in 24-bit mode, StripAddress is identical in function to the global variable Lo3Bytes: it returns the value of the low-order three bytes of the address passed in theAddress.  If the system is in 32-bit mode, however, StripAddress simply passes back the address unchanged.
  41.  
  42.  
  43.  
  44. -- part contents for background part 7
  45. ----- text -----
  46. _StripAddress:  The Untold Story
  47.  
  48. -- part contents for background part 2
  49. ----- text -----
  50. 213
  51.  
  52. -- part contents for background part 113
  53. ----- text -----
  54. OS Utilities
  55. Technical Note #212